package com.duobaoyu.dby.supply.admin.converter;

import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.duobaoyu.dby.channel.adapter.enums.ChannelCodeEnum;
import com.duobaoyu.dby.common.core.constant.CommonConstants;
import com.duobaoyu.dby.common.core.convert.bean.ReferenceMapper;
import com.duobaoyu.dby.supply.biz.util.ConverterUtils;
import com.duobaoyu.dby.supply.biz.util.CustomReferenceMapper;
import com.duobaoyu.dby.supply.common.biz.bo.config.PreWarningConfigGroupBO;
import com.duobaoyu.dby.supply.common.biz.bo.config.PreWarningConfigSelectBO;
import com.duobaoyu.dby.supply.common.biz.bo.config.PreWarningReminderConfigBO;
import com.duobaoyu.dby.supply.common.biz.bo.refund.AfterSaleContactInfoBO;
import com.duobaoyu.dby.supply.common.biz.bo.refund.AfterSaleItemOutBO;
import com.duobaoyu.dby.supply.common.biz.bo.refund.AfterSalePickUpBO;
import com.duobaoyu.dby.supply.common.biz.bo.refund.CustomerReturnAddressBO;
import com.duobaoyu.dby.supply.common.biz.vo.config.*;
import com.duobaoyu.dby.supply.common.biz.vo.invoice.InvoiceSettingVO;
import com.duobaoyu.dby.supply.common.biz.vo.message.ChannelMessageVO;
import com.duobaoyu.dby.supply.common.biz.vo.message.DelayMessageVO;
import com.duobaoyu.dby.supply.common.biz.vo.message.MqMessageVO;
import com.duobaoyu.dby.supply.common.biz.vo.refund.AfterSaleItemVO;
import com.duobaoyu.dby.supply.common.biz.vo.refund.AfterSalePickUpVO;
import com.duobaoyu.dby.supply.common.biz.vo.refund.AfterSaleSendBackAddressVO;
import com.duobaoyu.dby.supply.db.entity.config.ChannelCallbackMapping;
import com.duobaoyu.dby.supply.db.entity.config.PreWarningConfig;
import com.duobaoyu.dby.supply.db.entity.invoice.InvoiceSetting;
import com.duobaoyu.dby.supply.db.entity.message.ChannelMessage;
import com.duobaoyu.dby.supply.db.entity.message.DelayMessage;
import com.duobaoyu.dby.supply.db.entity.message.MqMessage;
import com.duobaoyu.dby.supply.db.entity.message.SystemLog;
import org.mapstruct.Builder;
import org.mapstruct.Mapper;
import org.mapstruct.Mapping;

import java.util.List;

/**
 * @author liyang
 * @version 1.0.0
 * @ClassName SupplyChainAdminConverter
 * @createTime 10:11:00 2023/10/16
 */
@Mapper(uses = {ReferenceMapper.class, CustomReferenceMapper.class},imports = {ConverterUtils.class, AfterSaleContactInfoBO.class, ChannelCodeEnum.class},builder = @Builder(disableBuilder = true), componentModel = CommonConstants.COMPONENT_MODEL)
public interface SupplyChainAdminConverter {

    /**
     * to ChannelCallbackMappingVO page
     * @param page
     * @return
     */
    Page<ChannelCallbackMappingVO> toChannelCallbackMappingPage(Page<ChannelCallbackMapping> page);

    /**
     * to PreWarningConfigGroupVO List
     * @param preWarningConfigGroup
     * @return
     */
    List<PreWarningConfigGroupVO> toPreWarningConfigGroupList(List<PreWarningConfigGroupBO> preWarningConfigGroup);

    /**
     * to PreWarningConfigSelectVO List
     * @param preWarningConfigSelects
     * @return
     */
    List<PreWarningConfigSelectVO> toPreWarningConfigSelectList(List<PreWarningConfigSelectBO> preWarningConfigSelects);

    /**
     * to PreWarningConfigVO
     * @param preWarningConfig
     * @return
     */
    PreWarningConfigVO toPreWarningConfig(PreWarningConfig preWarningConfig);

    /**
     * to PreWarningReminderConfigVO
     * @param preWarningReminderConfig
     * @return
     */
    PreWarningReminderConfigVO toPreWarningReminderConfig(PreWarningReminderConfigBO preWarningReminderConfig);

    List<InvoiceSettingVO> toInvoiceSettingList(List<InvoiceSetting> invoiceSettings);

    /**
     * to MqMessageVO Page
     * @param mqMessagePage
     * @return
     */
    Page<MqMessageVO> toMqMessagePage(Page<MqMessage> mqMessagePage);

    /**
     * to SystemLogVO
     * @param systemLog
     * @return
     */
    SystemLogVO toSystemLog(SystemLog systemLog);

    /**
     * to SystemLogVO Page
     * @param page
     * @return
     */
    Page<SystemLogVO> toSystemLogPage(Page<SystemLog> page);

	AfterSalePickUpVO toAfterSalePickUp(AfterSalePickUpBO afterSalePickUp);

	AfterSaleItemVO toAfterSaleItem(AfterSaleItemOutBO afterSaleItemOut);
	List<AfterSaleItemVO> toAfterSaleItemList(List<AfterSaleItemOutBO> afterSaleItemOutList);

    /**
     * to ChannelMessageVO Page
     * @param channelMessagePage
     * @return
     */
    Page<ChannelMessageVO> toChannelMessagePage(Page<ChannelMessage> channelMessagePage);

    /**
     * to ChannelMessageVO
     * @param channelMessage
     * @return
     */
    @Mapping(target = "channelMessageId", source = "id")
	@Mapping(target = "channelName", expression = "java(ChannelCodeEnum.getChannelCodeEnumByCode(channelMessage.getChannelCode()).getDescribe())")
    ChannelMessageVO toChannelMessage(ChannelMessage channelMessage);

    /**
     * to AfterSaleSendBackAddressVO
     * @param customerReturnAddress
     * @return
     */
    AfterSaleSendBackAddressVO toAfterSaleSendBackAddressVO(CustomerReturnAddressBO customerReturnAddress);

    /**
     * to DelayMessageVO Page
     * @param delayMessagePage
     * @return
     */
    Page<DelayMessageVO> toDelayMessagePage(Page<DelayMessage> delayMessagePage);

    /**
     * to DelayMessageVO
     * @param delayMessage
     * @return
     */
    @Mapping(target = "delayMessageId", source = "id")
    DelayMessageVO toDelayMessage(DelayMessage delayMessage);
}
